<?php

declare(ENCODING = 'UTF-8');

/*                                                                        *
 * This script is part of the TYPO3 project - inspiring people to share!  *
 *                                                                        *
 * TYPO3 is free software; you can redistribute it and/or modify it under *
 * the terms of the GNU General Public License version 2 as published by  *
 * the Free Software Foundation.                                          *
 *                                                                        *
 * This script is distributed in the hope that it will be useful, but     *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *	
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
 * Public License for more details.                                       *
 *                                                                        */	

/**
 * @package auxo
 * @subpackage Logging
 * @version $Id$
 */

/**	
 * The Log Event
 *	
 * @package auxo
 * @subpackage Logging
 * @version $Id$	
 * @copyright Copyright belongs to the respective authors
 * @author AHN
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
 */
class  tx_auxo_LogEvent  {

	private $message = '';
	private	$level = 0;
	private	$timestamp = 0;
	private $function = '';
	private	$file = '';
	private	$line = 0;
	
	/**
	 * Creates a new log event
	 *
	 * @param int $level log level
	 * @param string $message message to log
	 */
	public function __construct($level, $message) {
		$this->message = $message;
		$this->level = $level;
		$this->timestamp = time() + microtime();		
	}
	
	public function getTimestamp() {
		return $this->timestamp;
	}
	
	public function getLevel() {
		return $this->level;
	}
	
	public function getMessage() {
		return $this->message;
	}
	
	public function getSourceFilename() {
		return $this->file;
	}
	
	public function getLineNumber() {
		return $this->line;
	}
	
	public function getFunctionCall() {
		return $this->function;
	}
	
	/**
	 * Sets details about source code 
	 *
	 * @param string $file
	 * @param string $line
	 * @param string $function
	 */
	public function setSourceCodeDetails($file, $line, $function) {
		$this->file = $file;
		$this->line = $line;
		$this->function = $function;
	}
	
	public function __tostring() {
		return date('Y-m-d H:i', $this->getTimestamp()) . ' ' . $this->getMessage();
	}
}
?>